# @Filename:    Sample1-add
# @Author:      王佳伟
# @Time:        2025-02-28 9:25
# @Describe:    查找列表中的重复元素
import unittest


def find_duplicates(lst):
    from collections import Counter
    counts = Counter(lst)
    duplicates = [item for item, count in counts.items() if count > 1]
    return duplicates


class TestFindDuplicates(unittest.TestCase):
    def test_find_duplicates(self):
        self.assertEqual(find_duplicates([1, 2, 3, 2, 4, 3]), [2, 3])
        self.assertEqual(find_duplicates([1, 2, 3]), [])
        self.assertEqual(find_duplicates([]), [])


if __name__ == '__main__':
    unittest.main()
